<template>
	<view class="main">
		<view class="main_2">
			<u-card :title="title">
				<view class="" slot="body">
					<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
						<span>姓名：{{name}}</span>
					</view>
					<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
						<span>宿舍信息：{{susheInfo}}</span>	
					</view>
				</view>
			</u-card>
			<view class="step" v-if="status == 3">
				<u-steps direction="column" :list="numList2" :current="status"></u-steps>
			</view>
			<view class="step" v-else-if="status == 0||1||2">
				<u-steps direction="column" :list="numList" :current="status"></u-steps>
			</view>
			<view class="step" v-else>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				title:'我的宿舍信息',
				name:'',
				susheInfo:'',
				status:'',
				numList2: [{
					name: '发起申请'
				}, {
					name: '审核中'
				}, {
					name: '通过'
				}],
				numList: [{
					name: '发起申请'
				}, {
					name: '审核中'
				}, {
					name: '未通过'
				}],
			}
		},
		methods:{
			searchInfo(){
				var _this=this
				let value=uni.getStorageSync('myinfo')
				let studentId=value.user.studentId
				var url='http://taruinfo.work:8088/getDormitoryByLists?current=1&size=10&studentId='+studentId;
				uni.request({
					url:url,
					method:'get',
					success:function(res){
						console.log('请求的宿舍信息：')
						console.log(res.data)
						_this.name=res.data.data.records[0].name
						_this.susheInfo=res.data.data.records[0].dormitoryName+res.data.data.records[0].dormitoryId+'室'+res.data.data.records[0].bedId
						_this.status=res.data.data.records[0].payInfo
					}
				})
			}
		},
		created() {
			this.searchInfo()
		}
	}
</script>

<style>
	.u-card-wrap { 
			background-color: $u-bg-color;
			padding: 1px;
		}
		
		.u-body-item {
			font-size: 32rpx;
			color: #333;
			padding: 20rpx 10rpx;
		}
		.step{
			margin-left:50rpx;
		}
</style>
